{extend name="common/adminBase" /}
{block name="body"}
<style>
    .x-admin-sm .layui-icon {
        font-size: 20px;
    }
</style>
<body >
<div style="width: 90%;margin-top: 20px">
    <form class="layui-form" action="">
        <div class="layui-form-item">
            <label class="layui-form-label">用户名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" value="{$admin.name}" required  lay-verify="required" placeholder="请输入用户名称" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">手机号码</label>
            <div class="layui-input-block">
                <input type="text" name="phone" value="{$admin.phone}" maxlength="11" required  lay-verify="required" placeholder="请输入备案号码" autocomplete="off" class="layui-input">
            </div>
        </div>

        <div class="layui-form-item">
            <label class="layui-form-label">email邮箱</label>
            <div class="layui-input-block">
                <input type="text" name="email" value="{$admin.email}" required  lay-verify="required" placeholder="请输入email邮箱" autocomplete="off" class="layui-input">
            </div>
        </div>

        <input type="hidden" name="id" value="{$admin.id}">

        <div class="layui-form-item">
            <label class="layui-form-label">登录密码</label>
            <div class="layui-input-block">
                <input type="password" name="password"   placeholder="不修改密码请留空" autocomplete="off" class="layui-input">
            </div>
        </div>



        <br><br>
        <div class="layui-form-item">
            <div class="layui-input-block">
                <button class="layui-btn" lay-submit lay-filter="formDemo">立即提交</button>
                <button type="reset" class="layui-btn layui-btn-primary">重置</button>
            </div>
        </div>
    </form>
</div>


<script>
    //Demo
    layui.use('form', function(){
        var form = layui.form;

        //监听提交
        form.on('submit(formDemo)', function(data){
            $.ajax({
                url:'',
                data:data.field,
                type:'post',
                dataType:'json',
                success:function (res) {
                    if (res.status==1){
                        layer.msg(res.msg,{icon:1,time:1500},function(){
                            top.location.href='/admin/Index/index'
                        })
                    }else{
                        layer.alert(res.msg,function(index){
                            layer.close(index)
                        })
                    }
                }
            })
            return false;
        });
    });
</script>
</body>
{/block}